How to make a custom Tile
Introduction This guide will show you how to make a custom tile, which includes workbenches, ores, chests, pretty much anything you can interact with that isnt a mob or town npc. This tutorial is a bit more advanced than the general create an item guide or creating a custom weapon, so be prepared. Make sure your Tconfig is properly installed prior to starting this tutorial, or your items probably won't work as intended. Make sure you have set up a ModPack folder. Create a folder called "Tile" in your ModPack folder, as well as an "Item" folder, if you haven't done either of these already. Making a custom Tile The .ini file (Tile) #Go to your "Tile" folder #Create a new .ini file, and name it whatever your tile will be. eg 'Etherium Forge' #Open it, and write your code in: Stats id=-1 Width=3 Height=4 pick=0 axe=0 hammer=1 DropName=Etherium Forge Lighted=False MergeDirt=False Cut=False Alch=False Shine=1150 Shine2=True Stone=False WaterDeath=False LavaDeath=False Table=False BlockLight=True NoSunLight=True Dungeon=False SolidTop=False Solid=False NoAttach=False NoFail=False FrameImportant=False id=-1 means this tile looks for a custom .png and a custom .cs file. This attribute should be -1 on every custom tile. width=3 and height=4 are the number of terraria block spaces your tile takes up. For example this forge takes up 3 squares wide and 4 squares tall. pick=0 axe=0 hammer=1 This is the requirements for breaking the tile, this particular tile won't break froma pick or axe, but can be broken by a hammer. DropName=Etherium Forge This shows what should drop when your tile is broken. Lighted=False This means MergeDirt=False Wether your tile has been designed to have a blend and combine effect with dirt or not. Cut=False Can this item be cut down like a natural flower Alch=False Runs checks to see if your tile meets the conditions for planting/sprouting (for flowers). Shine=1150 This is the amount your item glows, similar to a forge or hellforge. Shine2=true This line is if your item sparkles, similar to a gold chest. WaterDeath/LavaDeath=False Wether your tile breaks when submerged in water or lava respectively. Table=False If your tile should act as a table as well. BlockLight=True If your tile should prevent light from moving through it. NoSunLight=True If your tile should prevent light from the background from shining through. Dungeon=False Wether your tiles counts as a dungeon tile. Also makes the tile bomb-proof. SolidTop=False Wether the tile has a surface on top of it (similar to wooden platforms). Solid=False Wether the tile is completely impassable or not. NoAttach=False Wether you can attach items to this tile (torches/platforms to the side, etc). NoFail=False Wether this tile is always broken in one hit or not. FrameImportant=False If your item isn't animated, this should be false. The .png file (Tile) #Now create a .png file with the same name as your ini file. #When making a tile make sure your png file has 2x2 grid lines on it like so. Every 2 pixels after a 16x16 square will be edited out in-game. #For each in game space you want your item to take up, a 16x16 square should be used (for example a 4 block tall and 4 block wide tile will end up with 16+2+16+2+16+2+16=70 pixels in both dimensions, leaving a 70x70 picture with 3 border lines going horizontal and vertical). The .ini file (Item) #If not already done, make sure you have an "Item" folder inside "ModPack" (Remember: ModPack doesn't have to be the same name, but Item must be inside your mod folder). #Create an .ini file (doesnt have to be the same name as the files in "Tile") inside the "Item" folder. Stats width=16 height=16 type=-1 useStyle=1 useAnimation=15 useTime=10 createTileName=Etherium Forge placeStyle=1 consumable=True ;almost always keep true, it will make sure the tile leaves your hands. autoReuse=True maxStack=1 useTurn=True scale=1 value=2000000 className=Item Recipe Items=1 Wood Amount=1 needWater=False This time only the important tags: createTileName=Etherium Forge - This is the tile that will be created when the item is used placeStyle=1 - This is the frame in the .png used when placing an item down (items that have a place style other than 1 would be a torch or wooden platform, depending on the tiles around them). consumable=True - This is self-explanetory, but still important. This decides wether the item gets decreased in number after a use. Recipe - The start of the recipe block, everything below this should be part of the recipe information. Items = 1 Wood - This is the current required items to create the Etherium Forge, this can be changed to suit your needs. If you want to know more about the item.ini file, a good resource is the Item Attributes page. After this point the tags won't be explained. The .png file (Item) #Create a .png file with the same name as the .ini file you just made. This .png also goes in the "Item" folder. The names must match, but they don't need to be the same name as the files from the "Tile" folder. #The item itself does not need grid lines on it, unlike the picture you made in the "Tile" folder. #The item .png should be somewhere between 32 and 16 pixels for each dimension. Now when you use your item, a tile should appear! If you want to add effects to your tile, a great next step can be found at the Custom Interface for Tiles Tutorial. Making a Custom Block The .ini file (Tile) #Go to your "Tile" folder #Create a new .ini file, and name it whatever your tile will be. eg 'Greenium' #Open it, and write your code in: Stats id=-1 Width=1 Height=1 pick=1 axe=0 hammer=0 DropName=Greenium Ore Lighted=False MergeDirt=False Cut=False Alch=False Shine=1150 Shine2=True Stone=False WaterDeath=False LavaDeath=False Table=False BlockLight=True NoSunLight=True Dungeon=False SolidTop=False Solid=True NoAttach=False NoFail=False FrameImportant=False The .png file (Tile) #Now create a .png file with the same name as your .ini file. #When making a tile intended to be a block, make sure your png file has 1x1 grid lines on it like so>>> #Unlike normal ores, this ore will NOT merge with dirt, so the green dirt does not matter. The .ini file (Item) #If not already done, make sure you have an Item folder in your modpack folder. #Create an ini file (doesnt have to be the same name as your tile). Stats width=16 height=16 type=-1 useStyle=1 useAnimation=15 useTime=10 createTileName=Greenium placeStyle=1 consumable=True autoReuse=True maxStack=250 useTurn=True scale=1 value=2000000 className=Item The .png file (Item) #Create a .png for your item, it should be somewhere around 16x16. #Add a recipe to test it or refer to the ore spawning page. #This picture is what the ore will look like after being mined or dropped on the ground (not placed). #SUCCESS! Making the Tile a Chest #Follow the steps above to create a tile of some sort. #Inside the tile's .cs file (the one in the tile folder, not the item folder) put: public void PlaceTile(int x, int y) { while(Main.tilex,y.frameX>0) x--; while(Main.tilex,y.frameY>0) y--; int ID = Chest.CreateChest(x, y); } public void UseTile(Player player, int x, int y) { while(Main.tilex,y.frameX>0) x--; // && Main.tilex-1,y.type type while(Main.tilex,y.frameY>0) y--; // && Main.tilex,y-1.type type Main.chestText = "Chest"; int ID= Chest.FindChest(x, y); Main.playerMain.myPlayer.chest = ID; Main.playerInventory = true; Main.PlaySound(12, -1, -1, 1); Main.playerMain.myPlayer.chestX = x; Main.playerMain.myPlayer.chestY = y; } public bool CanDestroyTile(int x, int y) { while(Main.tilex,y.frameX>0) x--; while(Main.tilex,y.frameY>0) y--; int ID= Chest.FindChest(x, y); if(ID -1) return true; for(int i=0;i 0) return false; } return true; //If there are no items in the chest, then let it be destroyed } public void KillTile(int x, int y, Player p) { while(Main.tilex,y.frameX>0) x--; while(Main.tilex,y.frameY>0) y--; Chest.DestroyChest(x, y); } #The first function controls what happens when the tile is placed in the world. #*The while functions correct the position, and the create chest function, well, creates a chest. #The Second function controls what happens when the tile is used. #*The function written here is similar to what happens when a normal chest is opened. #The third function controls when the tile can be destroyed. #*The first three lines find the chest, the remaining lines check to see if the chest has any items inside. #The final function controls what happens when the tile is to be destroyed. #*The chest is destroyed not only as a tile, but in the list of chests as well, so the game doesn't get clogged up with chests that can't be reused. Something like a piggy bank or safe might not have this in its code. Remember, more information about interfaces can be found at the Custom Interface for Tiles Tutorial.